<template>
  <div class="list-table noPad">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane :label="$t('甘特图')" name="first">
        <ganttHome ref="ganttHome" />
      </el-tab-pane>
      <el-tab-pane :label="$t('项目计划')" name="second">
        <dealSuperviseList ref="dealSuperviseList" :show-title="false" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import ganttHome from '@/views/deal/supervise/dhtmlxGantt/Home'
import dealSuperviseList from '@/views/deal/supervise/dealSuperviseList.vue'
export default {
  components: {
    ganttHome,
    dealSuperviseList
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      activeName: 'first'
    }
  },
  created() {
    this.openGanttEcharts(this.$route.query.id)
  },
  methods: {
    handleClick(tab) {
      if (tab.name === 'first') {
        this.openGanttEcharts(this.$route.query.id)
      }
      if (tab.name === 'second') {
        this.$nextTick(() => {
          this.$refs.dealSuperviseList.getList()
        })
      }
    },
    openGanttEcharts(dealIds) {
      this.$nextTick(() => {
        this.$refs.ganttHome.init(dealIds)
      })
    }
  }
}
</script>

<style scoped>

</style>
